package org.example.auth.domain;

import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

@Data
public class LoginUserDetails implements UserDetails {

    private  String username;
    private String password;
    private String tenantId;
    private String grantUser;
    private String deviceType;
    private String token;
    private List<GrantedAuthority> grantedAuthorities= Lists.newArrayList();

    public LoginUserDetails(String username, String password, List<GrantedAuthority> grantedAuthorities){
        this.username=username;
        this.password=password;
        this.grantedAuthorities=grantedAuthorities;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.grantedAuthorities;
    }

    @Override
    public String getPassword() {
        return this.password;
    }

    @Override
    public String getUsername() {
        return this.username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }



}
